
function go(ele,attr,target){
    clearInterval(ele.t);
    ele.t = setInterval(()=>{
        // 得到带有px的字符，利用parseInt取整
        var iNow = parseInt(getStyle(ele,attr));
        let speed = (target - iNow)/10;
        speed = speed < 0 ? Math.floor(speed) : Math.ceil(speed);
        if(iNow == target){
            clearInterval(ele.t)
        }else{
            ele.style[attr] = iNow + speed + "px";
        }

    },30);
}

function getStyle(ele,attr){
    if(ele.currentStyle){
        return ele.currentStyle[attr];
    }else{
        return getComputedStyle(ele,false)[attr];
    }
}
